#include "CubeApp.h"

CubeApp::CubeApp()
{
}

CubeApp::CubeApp(HINSTANCE hInstance, std::string winCaption)
	:D3DApp(hInstance, winCaption, D3DDEVTYPE_HAL, D3DCREATE_HARDWARE_VERTEXPROCESSING)
{
	cube = new Cube();
	//plane = new Plane(50, 50, 5);

	if (!CheckDeviceCaps())
	{
		MessageBox(0, "checkDeviceCaps() Failed", 0, 0);
		PostQuitMessage(0);
	}

	OnResetDevice();
}

CubeApp::~CubeApp()
{
	delete cube;
	//delete plane;
}

bool CubeApp::CheckDeviceCaps()
{
	D3DCAPS9 caps;
	HR(gD3DDevice->GetDeviceCaps(&caps));

	// Check for vertex shader version 2.0 support.
	if (caps.VertexShaderVersion < D3DVS_VERSION(2, 0))
		return false;

	// Check for pixel shader version 2.0 support.
	if (caps.PixelShaderVersion < D3DPS_VERSION(2, 0))
		return false;

	return true;
}